"""
MakerMove.py

Author: Miles Malerba
Date: 9-20-08

$Id: MakerMove.py 327 2008-10-17 02:47:24Z arguas2617 $
"""

from GameMove import GameMove

class MakerMove(GameMove):
    """represents a move made by the code maker"""

    #possible pieces
    NONE = 0
    WHITE = 1
    BLACK = 2

    #lookup table to get color strings
    color_lookup = ['None', 'White', 'Black']

    #lookup table to get colors in their respective
    #move protocol strings
    color_lookup_protocol = ['x', 'w', 'b']

    def __init__(self, response):
        """constructor. takes a list of integers representing the response
           to the breaker's guess. the list should have 4 elements.
        """
        self.pieces = response

    def to_string(self):
        """return a string representation of the maker's move"""
        result = 'Maker: '
        for piece in self.pieces:
            result += self.color_lookup[piece] + ' '
        return result

    def get_player(self):
        """get the player that made this move (Maker)"""
        return 'Maker'
        
    def get_color_name(self,color):
        """return the name of a color"""
        return self.color_lookup[color]

    def get_network_string(self):
        """Returns the move in move protocol notation"""
        result = "f "
        for piece in self.pieces:
            result += self.color_lookup_protocol[piece] + ' '
        return result
